<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>MN Consig</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <?php
        echo $this->headLink()
                ->prependStylesheet($this->baseUrl() . '/public/css/style.css')
                ->prependStylesheet($this->baseUrl() . '/public/css/bootstrap.css')
                ->prependStylesheet($this->baseUrl() . '/public/css/bootstrap-responsive.css')
        ?>
        <style type="text/css">
            body {
                padding-top: 60px;
                padding-bottom: 40px;
            }
        </style>

        <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
        <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
        <link rel="shortcut icon" href="../assets/ico/favicon.png">
    </head>
    <body>     
        <div class="navbar navbar-inverse navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container">
                    <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="brand" href="#">MN Consig</a>
                    <div class="nav-collapse collapse">
                        <?php $session = new Zend_Session_Namespace('role'); ?> 
                        <ul class="nav">
                            <?php if ($session->role != Role::VISITANTE): ?>
                                <li class="active"><a href="#">Home</a></li>
                                
                                <?php if ($session->role == Role::ADMINISTRADOR): ?>
                                    <li class="dropdown">
                                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Administra&ccedil&atildeo<b class="caret"></b></a>
                                        <ul class="dropdown-menu">
                                            <li class="divider"></li>

                                            <li class="nav-header">Usu&aacute;rio</li>
                                            <li><?php echo $this->href(array('controller' => 'usuario', 'action' => 'listar', 'module' => 'default', 'content' => '<i class="icon-list"></i> Listar', 'checkAcl' => true)) ?></li>
                                            <li><?php echo $this->href(array('controller' => 'usuario', 'action' => 'criar', 'module' => 'default', 'content' => '<i class="icon-file"></i> Cadastrar', 'checkAcl' => true)) ?></li>                  					                          

                                            <li class="nav-header">Cliente</li>
                                            <li><?php echo $this->href(array('controller' => 'cliente', 'action' => 'listar', 'module' => 'default', 'content' => '<i class="icon-list"></i> Listar', 'checkAcl' => true)) ?></li>
                                            <li><a id="modal-996337" href="#modal-container-996337" role="button" data-toggle="modal"><i class="icon-file"></i> Cadastrar</a></li>
                                            
                                            <li class="nav-header">Banco</li>
                                            <li><?php echo $this->href(array('controller' => 'banco', 'action' => 'listar', 'module' => 'default', 'content' => '<i class="icon-list"></i> Listar', 'checkAcl' => true)) ?></li>
                                            <li><a id="modal-996877" href="#modal-container-996877" role="button" data-toggle="modal"><i class="icon-file"></i> Cadastrar</a></li>                                            
                                            
                                            <li class="nav-header">Filial</li>
                                            <li><?php echo $this->href(array('controller' => 'filial', 'action' => 'listar', 'module' => 'default', 'content' => '<i class="icon-list"></i> Listar', 'checkAcl' => true)) ?></li>
                                            <li><a id="modal-996233" href="#modal-container-996233" role="button" data-toggle="modal"><i class="icon-file"></i> Cadastrar</a></li>                                                                                        
                                        </ul>
                                    </li>
                                
                            <?php endif; ?>
                        <?php endif; ?>

                        <?php if ($session->role != Role::VISITANTE): ?>
                                    <li><a href="#modal-editar-usuario-<?php echo $session->idUsuario?>" role="button" data-toggle="modal">Editar</a></li>
                        <?php endif; ?>                                    
                                    

                        
                        <?php if ($session->role != Role::VISITANTE): ?>            
                        <li><form action="<?php echo $this->baseUrl() ?>/cliente/listar" method="post" class="navbar-search pull-left">
                                <input type="text" name="nome-cpf" class="search-query" placeholder="Nome ou CPF">
                                <button type="submit" class="search-query"><i class="icon-search"></i></button>
                            </form>
                        </li>
                        <?php endif; ?>
                        <li><a><?php echo DbTable_Usuario::getUserById($session->idUsuario)->nome ?> (<?php echo ucfirst(strtolower(str_replace('CLIENTE', 'USU&aacute;RIO', Zend_Controller_Action_HelperBroker::getStaticHelper('role')->aliasToName($session->role))))?>)</a></li>
                        <li>
                            <?php echo $this->href(array('controller' => 'acesso', 'action' => 'logout', 'module' => 'default', 'content' => 'Sair', 'checkAcl' => true)) ?>
                        </li>
                        
                        </ul>

                    </div>
                </div>
            </div>
        </div> 
        <div class="container">
            <div class="alert alert-error" id="alert-error-rn"> 
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                <span></span>
            </div>
            <?php echo $this->layout()->content; ?>
            <hr>
            <?php echo $this->partial('partials/editar-usuario.phtml', array('usuario' => DbTable_Usuario::getUserById($session->idUsuario))); ?> 
            <?php echo $this->partial('partials/cadastrar-cliente.phtml'); ?> 
            <?php echo $this->partial('partials/cadastrar-banco.phtml'); ?> 
            <?php echo $this->partial('partials/cadastrar-filial.phtml'); ?>

            <div id="baseUrl"><?= $this->baseUrl() ?></div>
        </div>
    </body>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
    <script type="text/javascript" src="http://cdn.transparensee.com/lib/jquery-plugin/touchpunch/0.2.2/jquery.ui.touch-punch.min.js"></script>
    <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.1/js/bootstrap.min.js"></script>

    <?php
    echo $this->headScript()->prependFile($this->baseUrl() . '/public/js/javascript.js')
            ->prependFile($this->baseUrl() . '/public/js/mask.js')
            ->prependFile($this->baseUrl() . '/public/js/validatorCpf.js')
            ->prependFile($this->baseUrl() . '/public/js/maskedinput.js');
    ?>
</html>

